//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

package uxgenes.app;

// #ifdef UNLOCK_SCREEN

import android.app.KeyguardManager;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;


//
// Keyguard Service
//

public class KeyguardService extends Service
{
// variables //
	private BroadcastReceiver	_receiver;
	

// methods //
	@Override
	public IBinder onBind (Intent arg0)
	{
		return null;
	}

	@SuppressWarnings("deprecation")
	@Override
	public void onCreate()
	{
		KeyguardManager.KeyguardLock k1;
		KeyguardManager km = (KeyguardManager) getSystemService( KEYGUARD_SERVICE );
		k1 = km.newKeyguardLock( "IN" );
		k1.disableKeyguard();
		
		IntentFilter filter = new IntentFilter( Intent.ACTION_SCREEN_ON );
		filter.addAction( Intent.ACTION_SCREEN_OFF );
		_receiver = new LockScreenReceiver();
		registerReceiver( _receiver, filter );
		
		super.onCreate();
	}

	@Override
	public void onDestroy()
	{
		unregisterReceiver( _receiver );
		super.onDestroy();
	}

}

// #endif UNLOCK_SCREEN
